{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>商家隐私协议</h5>
                </div>
                <div class="ibox-content">
                    <div class="panel-body">
                        <div class="builder-tabs builder-form-tabs">
                        </div>
                        <div class="form-group"></div>
                        <div class="builder-container">
                        <div class="row">
                            <div class="col-xs-12">
                                <form class="form-horizontal" id="Group">
                                    <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">商家隐私协议：</label>
                                            <div class="layui-input-block" id="LAY_editor" lay-verify="editor" style="padding: 0px 52px">
                                                <p>{$shopAgreement}</p>
                                            </div>
                                        </div>
                                    <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                                        <div class="layui-input-block">
                                            <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
                                            </button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>

    var editor = wk.wang({elem:'#LAY_editor'});
    layui.use(['form'], function() {
        var form = layui.form;
        form.verify({
            editor:function(value,item){
                if(editor.txt.html() == '<p><br></p>'){
                    return '请填写内容';
                }
            }
        });
        form.on('submit(component-form-element)', function (data) {
            data.field.shopAgreement = editor.txt.html();
            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"{:url('Agreement/shopyinsi')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        wk.success(res.msg, "{:url('Agreement/shopyinsi')}");
                    } else {
                        wk.error(res.msg);
                    }
                }
            })
        });
    });

</script>
</body>
</html>
